1. Field of the Invention
The invention relates to an input circuit to commonly use input ports of a microcomputer, such as an automotive electronic control unit, that has multiple contact inputs, such as switches, on the way to a ground. The invention also relates to an electronic control unit with such an input circuit, and particularly to those suitably used to judge the states of contacts between large power loads and the ground.
2. Description of the Related Art
A microcomputer, such as an automotive electronic control unit, has a multitude of contact inputs for various controls. The number of I/O ports of the microcomputer are predetermined. Microcomputers with fewer I/O ports generally are smaller and less expensive than microcomputers of comparable performance with more I/O ports. Accordingly, it is desirable to use a microcomputer with fewer I/O ports if this microcomputer can satisfy a desired performance. However, the number of I/O ports seldom coincides with the number of the contact input terminals. An input circuit is provided to commonly use one I/O port by a plurality of contact input terminals if there is a shortage of I/O ports.
Japanese Unexamined Patent Publication No. 2002-185293 and FIG. 4 disclose a block diagram of an electronic control unit (ECU). With reference to FIG. 4, a typical prior art input circuit 1 is at an input side of a microcomputer 2. In this input circuit 1, contact inputs given from corresponding contact input terminals in1 to in8 by eight switches sw1 to sw8 can be judged using six I/O ports p01, p02, p1 to p4 of the microcomputer 2.
One end of each switch sw1 to sw8 is grounded, whereas the other end thereof is connected with the corresponding contact input terminal in1 to in8. The respective contact terminals in1 to in8 are connected with low-side terminals of loads (a lamp load 1 is connected with the contact input terminal in1 in FIG. 4), and high-side terminals of the loads are connected with high-side terminals of batteries b. Accordingly, the respective contact input terminals in1 to in8 take a ground potential when the switches sw1 to sw8 are turned on while being open or having a specified high level when the switches sw1 to sw8 are turned off.
In order to read the potentials at the respective contact input terminals in1 to in 8, cathodes of diodes d11 to d81 are connected with the corresponding contact input terminals in1 to in 8, and anodes thereof are connected with anodes of corresponding diodes d12 to d82 arranged in inverse series via resistors r11 to r81. Cathodes of the diodes d12 to d82 are connected in pairs which become common inputs, and are connected with the respective I/O ports p1 to p4 as input ports of the microcomputer 2 via resistors r1 to r4 and resistors r5 to r8. On the other hand, ends of pull-up resistors r12 to r82 at one side are connected with nodes t1 to t8 between the resistors r11 to r81 and the anodes of the diodes d12 to d82. The other ends of the pull-up resistors r12, r32, r52 and r72 are commonly connected and those of the pull-up resistors r22, r42, r62 and r82 are commonly connected, and these ends are further connected with a high-level power supply Vcc via control transistors q1, q2. Selection outputs are given to bases of the control transistors q1, q2 from the I/O ports p01, p02 as output ports of the microcomputer 2. The control transistors q1,q2 are of the p type. The control transistors q1, q2 are turned off not to be selected when a high-level voltage VDD (5 V) is outputted from the I/O ports p01, p02, whereas they are turned on to be selected when a low-level voltage (ground potential) is outputted therefrom.
Accordingly, if the control transistor q1 is selected and the control transistor q2 is not selected when the I/O port p01 is held low and the I/O port p02 is held high, potentials at the nodes t1, t3, t5, t7 corresponding to the odd-numbered contact input terminals in1, in3, in5, in7 are pulled up to the high-level potential Vcc by the pull-up resistors r12, r32, r52, r72. At this time, if the corresponding switches sw1, sw3, sw5, sw7 are off, a voltage vref lower than the potential Vcc by a predetermined voltage such as a voltage between an emitter and a collector of the transistor q1 or forward voltages of the diodes d12, d32, d52, d72 is fed to the I/O ports p1 to p4 of the microcomputer 2. On the other hand, if the switches sw1, sw3, sw5, sw7 are on, the respective nodes t1, t3, t5, t7 take the ground potential, which is fed to the respective I/O ports p1 to p4.
The nodes t2, t4, t6, t8 corresponding to the even-numbered contact input terminals in2, in4, in6, in8 of the non-selected side take the ground potential if the corresponding switches sw2, sw4, sw6, sw8 are on. However, since the diodes d22, d42, d62, d82 are shut off, there is no influence on the potential fed to the I/O ports p1 to p4. If the switches sw2, sw4, sw6, sw8 are off, the corresponding contact input terminals in2, in4, in6, in8 are open since the transistor q2 is off, wherefore there is no influence on the potential fed to the I/O ports p1 to p4.
In this way, when the I/O port p01 is held low and the I/O port p02 is held high, the states of the switches sw1, sw3, sw5, sw7 connected with the odd-numbered contact input terminals in1, in3, in5, in7 can be judged. When the I/O port p02 is held low and the I/O port p01 is held high, the states of the switches sw2, sw4, sw6, sw8 connected with the even-numbered contact input terminals in2, in4, in6, in8 can be judged. As compared to a case where the I/O ports are caused to correspond to the respective contact input terminals in1 to in 8, the contact inputs can be judged using a smaller number of ports.
There are many large power loads in an automotive electronic control unit, including the lamp load 1, a wiper motor and a heating coil, and their load currents may be drawn directly by the switches sw1 to sw8. A contact resistance when the switches sw1 to sw8 are on is, for example, 0.2 (Ω). Accordingly, if a load current of, e.g. 10 (A) flows, the potentials at the respective contact input terminals in1 to in8 rise to 2(V) from the ground potential when the switches sw1 to sw8 are on with the input circuit 1 constructed as above.
On the other hand, a low-level voltage VIL recognizable by the I/O ports p1 to p4 of a general inexpensive microcomputer 2 is about VDD×0.2 (V). Accordingly, if VDD=5(V), VIL=1 (V). If the potential rises from the ground potential by as much as 2(V), the microcomputer 2 erroneously recognizes the switches sw1 to sw8 to be off even though they are on.
To solve such a problem, the electronic control unit must not depend on the low-level recognizable voltage and must use a microcomputer having a high low-level recognizable voltage VIL (=VDD×0.5(V)) or a microcomputer having an analog-to-digital converting function, as disclosed in Japanese Unexamined Patent Publication No. 2002-185293. This requires an expensive microcomputer that is not generally used.
An object of the present invention is to provide an input circuit capable of precisely judging the states of contacts even upon a rise of a contact input from a ground potential due to the on-resistance of a switch, and an electronic control unit provided with such an input circuit.